<?php
namespace app\index\controller;
use think\Controller;
use think\facade\Cookie;
class Common extends Controller
{
	protected $beforeActionList = ['isLogin'];
	protected function isLogin(){
		if(!Cookie::get('username')){
			return $this->redirect('Login/login');
		}
		if(!Cookie::get('id')){
			return $this->redirect('Login/login');
		}
	}
	public function message($code,$msg='',$data=[]){
		$msg=[
			'code'=>$code,
			'msg'=>$msg,
			'data'=>$data
		];
		return json($msg);
	}
}